package com.slz3.business.module.socialManagement.socSign.domain;

import com.slz3.business.frame.enums.AuditFlag;
import com.slz3.business.frame.enums.UsingFlag;
import com.slz3.business.frame.util.UUIDUtils;
import com.slz3.business.frame.util.VE;

import java.time.LocalDateTime;

public class SocSignFactory {

    /**
     * 初始化基础属性值
     */
    public static SocSign initBaseFields(SocSign socSign) {
        if (socSign.getUuid() == null) {
            socSign.setUuid(UUIDUtils.generateUUID());
            socSign.setCreateTime(LocalDateTime.now());
            if (VE.isEmpty(socSign.getSerAudit())) {
                socSign.setSerAudit(AuditFlag.WAIT_SUBMIT);
            }
            if (VE.isEmpty(socSign.getSerUsing())) {
                socSign.setSerUsing(UsingFlag.ENABLE);
            }
        } else {
            socSign.setLastModifyTime(LocalDateTime.now());
        }
        return socSign;
    }

    /**
     * 初始化基础属性值
     */
    public static SocSign initBaseFields() {
        return initBaseFields(newTemStyle());
    }

    public static SocSign newTemStyle() {
        return new SocSign();
    }

}
